<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>Home</title>
    <link rel="stylesheet" th:href="@{static/css/layui.css}">
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo">运动会管理系统</div>
        <!-- 头部区域（可配合layui已有的水平导航） -->
        <ul class="layui-nav layui-layout-left">

        </ul>
        <ul class="layui-nav layui-layout-right">
            <div th:if="${session.user}">
                <li class="layui-nav-item">
                    <a href="javascript:;">
                        <i class="layui-icon layui-icon-user" style="font-size: 15px"></i>
                        <span th:text="${session.user.getNum()}">unknown</span>
                    </a>
                    <dl class="layui-nav-child">
                        <dd th:if="${session.user.getIdentity().equals('2')}"><a th:href="@{userinfo}">基本资料</a></dd>
                        <dd><a th:href="@{/toPage(url=rePassword)}">修改密码</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item"><a href="user/logout">退出</a></li>
            </div>
            <div th:unless="${session.user}">
                <li class="layui-nav-item"><a th:href="@{/toPage(url=login)}">登录</a></li>
            </div>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree layui-inline" lay-filter="test" style="margin-right: 10px;">
                <li class="layui-nav-item"><a href="/sports">主页</a></li>
                <li class="layui-nav-item layui-nav-itemed">
                    <a href="javascript:;">当前赛况</a>
                    <dl class="layui-nav-child">
                        <dd><a th:href="@{/toPage(url=scoreSituation)}">田赛</a></dd>
                        <dd><a th:href="@{/toPage(url=scoreSituationJ)}">径赛</a></dd>
                    </dl>
                </li>
                <div th:if="${session.user}">
                    <li class="layui-nav-item" th:if="${session.user.getIdentity().equals('2')}"><a th:href="@{/toPage(url=signup)}">我要报名</a></li>
                    <li class="layui-nav-item" th:if="${session.user.getIdentity().equals('2')}"><a th:href="@{/toPage(url=myRegistration)}">我的报名</a></li>
                    <li class="layui-nav-item layui-nav-itemed" th:if="${session.user.getIdentity().equals('0') || session.user.getIdentity().equals('1')}">
                        <a href="javascript:;">上传成绩</a>
                        <dl class="layui-nav-child">
                            <dd><a th:href="@{/toPage(url=scoreEntryT)}">田赛</a></dd>
                            <dd><a th:href="@{/toPage(url=scoreEntryJ)}">径赛</a></dd>
                        </dl>
                    </li>
                    <li class="layui-nav-item" th:if="${session.user.getIdentity().equals('1')}"><a th:href="@{/toPage(url=registrationReview)}">报名审核</a></li>
                    <li class="layui-nav-item" th:if="${session.user.getIdentity().equals('1')}"><a th:href="@{/toPage(url=perManagement)}">人员管理</a></li>
                    <li class="layui-nav-item" th:if="${session.user.getIdentity().equals('1')}"><a th:href="@{/toPage(url=noticeManage)}">公告管理</a></li>
                    <li class="layui-nav-item" th:if="${session.user.getIdentity().equals('1')}"><a th:href="@{/toPage(url=volunteer)}">志愿者名单</a></li>
                    <li class="layui-nav-item" th:if="${session.user.getIdentity().equals('1')}"><a th:href="@{/toPage(url=projectManage)}">项目</a></li>
                </div>
            </ul>
        </div>
    </div>

    <div class="layui-body">
        <!-- 内容主体区域 -->

        <div class="layui-row">
            <div class="layui-col-md4 layui-col-md-offset5">
                <h1 style="height: 70px;">径赛成绩录入</h1>
            </div>
        </div>

        <table id="run100" lay-filter="run100"></table>


    </div>

</div>


<script th:src="@{static/layui.js}"></script>
<script th:src="@{static/jquery.js}"></script>

<script>
    layui.use('element', function () {
        var element = layui.element;
    });
</script>

<script>
    layui.use('table', function () {
        var table = layui.table;

        table.render({
            elem: '#run100'
            , url: "score/get?projectId=1"
            , toolbar: 'default'
            , title: '100m数据表'
            , limit: 200
            , cellMinWidth: 80
            , even: true //开启隔行背景
            , cols: [
                [
                    {field: 'id', title: 'ID', width: 150, fixed: 'left', sort: true}
                    , {field: 'stuNum', title: '参赛者学号', width: 150}
                    , {field: 'stuName', title: '参赛者', width: 150}
                    , {field: 'projectName', title: '参赛项目', width: 150, sort: true}
                    , {field: 'score0', title: 'score0', width: 150, edit: 'text'}
                    , {field: 'score1', title: 'score1', width: 150, edit: 'text'}
                    , {field: 'score2', title: 'score2', width: 150, edit: 'text'}
                    , {field: 'score3', title: 'score3', width: 150, edit: 'text'}
                    , {field: 'score4', title: 'score4', width: 150, edit: 'text'}
                    , {field: 'score5', title: 'score5', width: 150, edit: 'text'}

                ]
            ]
        });

    });
</script>

<script>
    layui.use('table', function(){
        var table = layui.table;

        //监听单元格编辑
        table.on('edit(run100)', function(obj){
            var value = obj.value //得到修改后的值
                ,data = obj.data //得到所在行所有键值
                ,field = obj.field; //得到字段
            let s = {value:value, field:field,key:data.id};
            $.post("score/modifyGrade",s,function (result){
                layer.msg(result);
            },"text")
        });
    });
</script>


</body>
</html>
